{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  输入输出"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 输入"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "1、在python2.x中raw_input( )和input( )，两个函数都存在，其中区别为\n",
    "raw_input( )---将所有输入作为字符串看待，返回字符串类型\n",
    "input( )-----只能接收“数字”的输入，在对待纯数字输入时具有自己的特性，\n",
    "它返回所输入的数字的类型（ int, float ）\n",
    "\n",
    "2、在python3.x中raw_input( )和input( )进行了整合，去除了raw_input( )，仅保留了input( )函数，\n",
    "   其接收任意任性输入，将所有输入默认为字符串处理，并返回字符串类型。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入名字：xuwenyuan\n",
      "您的姓名为：xuwenyuan\n"
     ]
    }
   ],
   "source": [
    "userName = input('请输入名字：')\n",
    "print('您的姓名为：'+userName)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "类型：<class 'str'>\n"
     ]
    }
   ],
   "source": [
    "print('类型：'+str(type(userName)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入密码：123456\n",
      "您的密码为：123456\n",
      "类型：<class 'str'>\n"
     ]
    }
   ],
   "source": [
    "passWord = input('请输入密码：')\n",
    "print('您的密码为：'+passWord)\n",
    "\n",
    "#输入类型\n",
    "print('类型：'+str(type(passWord)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 输出"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "说明：<br>\n",
    "1 python2.x print 'xxxxx'  \n",
    "2.python3.x print('xxxxx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world\n",
      "给我的卡---印度语，你好的意思\n",
      "我们的网址是: shenweiyun.cn\n",
      "我们的网址是: shenweiyun.cn\n"
     ]
    }
   ],
   "source": [
    "# 打印提示\n",
    "print('hello world')\n",
    "print('给我的卡---印度语，你好的意思')\n",
    "\n",
    "#打印变量\n",
    "url = 'shenweiyun.cn'\n",
    "\n",
    "print('我们的网址是:',url)\n",
    "\n",
    "#################################\n",
    "# 常见变量 #\n",
    "#################################\n",
    "# 字符串: %s\n",
    "# 整数: %d\n",
    "# 浮点数: %f\n",
    "\n",
    "print('我们的网址是: %s'%url)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  注释"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 单行注释"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "用#号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "OKOK\n"
     ]
    }
   ],
   "source": [
    "#print用于输出，input用于输入\n",
    "print('OKOK')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 多行注释"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "'''用三个单引号'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入名字：xuwenyuan\n",
      "您的姓名为：xuwenyuan\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "1、在python2.x中raw_input( )和input( )，两个函数都存在，其中区别为\n",
    "raw_input( )---将所有输入作为字符串看待，返回字符串类型\n",
    "input( )-----只能接收“数字”的输入，在对待纯数字输入时具有自己的特性，\n",
    "它返回所输入的数字的类型（ int, float ）\n",
    "\n",
    "2、在python3.x中raw_input( )和input( )进行了整合，去除了raw_input( )，仅保留了input( )函数，\n",
    "   其接收任意任性输入，将所有输入默认为字符串处理，并返回字符串类型。\n",
    "'''\n",
    "userName = input('请输入名字：')\n",
    "\n",
    "print('您的姓名为：'+userName)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [default]",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "469px",
    "left": "494px",
    "top": "106px",
    "width": "273px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
